home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Arashi 1.1 / Game Source / GameCompiler (jam) / Parser.h < prev   
Encoding:
C/C++ Source or Header  |  1993-03-02  |  1.4 KB  |  62 lines  |  [TEXT/KAHL]

  1. /*/
  2.      Project Arashi: Parser.h
  3.      Major release: Version 1.1, 7/22/92
  4.  
  5.      Last modification: Tuesday, March 2, 1993, 19:18
  6.      Created: Saturday, February 13, 1993, 13:20
  7.  
  8.      Copyright © 1993, Juri Munkki
  9. /*/
  10.  
  11. #pragma once
  12.  
  13. enum    {    kLexPlus, kLexMinus, kLexAbs,
  14.             kLexMultiply, kLexDivide, kLexModulo, kLexPower,
  15.             kLexLt, kLexGt, kLexEq,
  16.             kLexMin, kLexMax,
  17.             kLexOpenParen, kLexCloseParen,
  18.             kLexRowOffset, kLexConstant, 
  19.             kUnaryMinus, kLexVariable,
  20.             kLexFun0, kLexFun1,
  21.             kLexLevel,
  22.             kAssignment,
  23.             kParseError, kLexEof    };
  24.  
  25. enum    {    kMinKey, kMaxKey,
  26.             kRandomKey, kSinKey, kCosKey,
  27.             kIntKey, kRoundKey,
  28.             kLevelKey, firstVariable };
  29.  
  30. typedef struct
  31. {
  32.     short    kind;            //    Determines what this lexical symbol is.
  33.  
  34.     union
  35.     {    double    floating;        //    Used for numeric constants.
  36.         long    offset;            //    Used as offset into datacube.
  37.         long    token;            //    Token for variable
  38.         long    level;            //    Level number from level statement
  39.     }    value;
  40. }    LexSymbol;
  41.  
  42. typedef    struct
  43. {
  44.     StringPtr    input;
  45.     Handle        output;
  46.     long        realSize;
  47.     long        logicalSize;
  48.  
  49.     LexSymbol    lookahead;
  50.     
  51.     short        stackDepth;
  52.     short        stackMax;
  53. }    ParserVariables;
  54.  
  55. void        ParseCompare();
  56. void        ParseExpr();
  57. void        LexRead(LexSymbol *theSymbol);
  58. void        EmitInstruction(LexSymbol *theOperation,short stackChange);
  59. void        LoadLevel(short whichLevel);
  60. double        EvalVariable(long token);
  61. void        WriteVariable(long token, double value);
  62.